package com.myapp.dao.impl;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.Query;

import com.myapp.dao.CatalogoDao;
import com.myapp.dto.in.ConsultaCatalogoIn;
import com.myapp.entity.Catalogo;
import com.myapp.entity.Elemento;
import com.myapp.dao.impl.GeneralDaoImpl;

@Stateless
public class CatalogoDaoImpl extends GeneralDaoImpl<Catalogo, Long> implements
		CatalogoDao {

	
	@SuppressWarnings("unchecked")
	public List<Elemento> consultarCatalogo(ConsultaCatalogoIn in) {
			
		Query query = em.createNamedQuery("consultarCatalogoElemento");
		query.setParameter("idCatalogo",in.getIdCatalogo());
		List<Elemento> listCatalogo = (List<Elemento>)query.getResultList();
		if(listCatalogo!=null && listCatalogo.size()>0){
			return listCatalogo;
		}
		return null;
	}

}
